#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x

case "$1" in
  help | robots.txt:help)
    help_content_func () {
      declare desc="return robots.txt plugin help content"
      cat<<help_content
    robots.txt:disallow <app>, Discourages web crawlers from indexing this app
    robots.txt:allow <app>, Doesn't discourage web crawlers from indexing this app
help_content
  }

  if [[ $1 = "robots.txt:help" ]] ; then
      echo -e 'Usage: dokku robots.txt[:COMMAND]'
      echo ''
      echo 'Manage robots.txt for applications.'
      echo ''
      echo 'Additional commands:'
      help_content_func | sort | column -c2 -t -s,
  else
      help_content_func
  fi
;;

*)
  exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;

esac
